package com.gress.shop.controller.chart;

import com.gress.shop.annotation.FireLogger;
import com.gress.shop.service.IChartClientService;
import com.gress.shop.vo.SwalReturn;
import com.wordnik.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/chart/visit")
@Api("请求图表")
public class ChartVisitController {

    @Resource
    private IChartClientService chartClientService;

    @RequestMapping("to_show")
    @FireLogger("请求图表")
    public String  toShow(){
        return "chart/visit";
    }

    @RequestMapping("get_visit_week_num")
    @FireLogger("获取一周请求量")
    @ResponseBody
    public SwalReturn<List<Integer>> getVisitWeekNum(Long params[], @RequestParam(required = false) String email) {
        List<Integer> numList = chartClientService.queryVisitNum(params, email);
        return new SwalReturn<>(numList);
    }
    


}
